<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>短信模板</title>
<script type="text/javascript" src="../js/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="../js/layer/layer.min.js"></script>
<script type="text/javascript" src="../js/jquery.ui.js"></script>
<link href="../Style/css.css" rel="stylesheet" type="text/css" />
<link href="../Style/smoothness/jquery.ui.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
     
	$(function(){
		 //全选
		 $("#checkAll").click(function(){
			  if ($(this).attr("checked")) {
				$("input[type='checkbox']").not($("#chakan")).attr("checked", true);
			  } else {
				$("input[type='checkbox']").not($("#chakan")).attr("checked", false);
			  }
		 });
		 
		 //点击选择
		 $('#xuanze').click(function(){
		     var jsonStr="[";
			 if($('input[name^=active]:checked').length>0){
			   $('input[name^=active]:checked').each(function(){
			    var id=$(this).parent().next().text();
				var textValue=$(this).parent().next().next().text();
				var objStr='{"id":"' +id+'","textValue":"'+textValue+'"},';
				jsonStr+=objStr;
			});
		}
			
			 if(jsonStr.charAt(jsonStr.length-1)==','){
			  jsonStr=jsonStr.substr(0,jsonStr.length-1);
			 }
			 jsonStr+="]";
		 
			 var pre= '<b style="margin-left:10px">';
			// +马佳+
			 var mid='</b> <img  onclick="dddd()"  id=';
			
			 //+df+
			 var after=' src="Images/delitem.png" style="cursor:pointer;">';
			
			 var str='';
			 var obj = jQuery.parseJSON(jsonStr);
			 for(var i=0;i<obj.length;i++){
			  // str=str+pre+obj[i].textValue+mid+onj[i].id+after;
			  var sid=obj[i]['id'];
			  var stext=obj[i]['textValue'];
			  str=str+pre+stext+mid+sid+after;
			
			 }
			 $(parent.document.getElementById("xuanzeValue")).append(str);
		
			  parent.layer.closeAll();
		 });
		
	});
	
</script>
</head>
<body>
  <div class="content" style="height:750px;">
    <div class="listtable">
      <div class="listheader">
        短信模板
        <input style="margin-top:5px;" class="button_search mr5 fright" type="submit" name="button5" id="xuanze" value="选择"/>
        </div>
		<table cellpadding="0" cellspacing="0" width="100%">
           	<tr class="listtable_tr">
           		<th width="4%"><input id="checkAll" type="checkbox" value="" /></th>
               	<th width="">短信内容</th>
            </tr>
            <tr>
                <td width="28"><input name="active1" type="checkbox" value="" /></td>
                <td>短信模板1</td>
            </tr>
            <tr class="td_repeat">
                <td width="28"><input name="active2" type="checkbox" value="" /></td>
                <td>短信模板2</td>
            </tr> 
            <tr>
                <td width="28"><input name="active3" type="checkbox" value="" /></td>
                <td>短信模板3</td>
            </tr>
            <tr class="td_repeat">
                <td width="28"><input name="active4" type="checkbox" value="" /></td>
                <td>短信模板4</td>
            </tr>
        </table>
      </div>
  </div>
</body>
</html>
